package wiki.hitime.stl.daq.enums;


import wiki.hitime.stl.daq.bean.base.NameValue;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public enum ExecuteActionEnum {

    // 执行动作
    ENABLED(1, "已启用"),
    EXECUTING(2, "执行中"),
    DISABLED(3, "已停用");


    private int status;
    private String msg;

    ExecuteActionEnum(int status, String msg) {
        this.status = status;
        this.msg = msg;
    }

    public int getStatus() {
        return this.status;
    }

    public String getMsg() {
        return this.msg;
    }

    public static ExecuteActionEnum valueOf(int status) {
        for (ExecuteActionEnum enumItem : ExecuteActionEnum.values()) {
            if (enumItem.getStatus() == status) {
                return enumItem;
            }
        }
        return null;
    }

    public static List<NameValue> getList() {
        return Arrays.stream(ExecuteActionEnum.values()).map(item -> new NameValue(item.getMsg(), item.getStatus())).collect(Collectors.toList());
    }
}
